package com.ribbon.controler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: where
 * @Date: 2022/07/22/15:41
 * @Description:
 */
@RestController
@RequestMapping("ribbon")
public class EurekaClientRibbonController {
    @Autowired
    private RestTemplate restTemplate;

    @Value("Service-url")
    private String eurekaClientUrl;

    @GetMapping("/{id}")
    public String ribbonTest(@PathVariable("id") int id) {
        return restTemplate.getForObject(eurekaClientUrl + "/{id}", Integer.class, id).toString();
    }

    @PostMapping("/eureka")
    public String ribbonTest02(){
        return null;
    }


}
